package com.xpxrule.dataobject.base;

import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * @version 1.0
 * @Author xiangpengxiang
 * @Date 2024/11/20 17:01
 * @注释
 */
@EqualsAndHashCode
public class Range<T> implements Serializable {

    private T begin;
    private T end;

    public Range() {}

    public Range(T begin, T end) {
        this.begin = begin;
        this.end = end;
    }

    public T getBegin() {
        return begin;
    }

    public void setBegin(T begin) {
        this.begin = begin;
    }

    public T getEnd() {
        return end;
    }

    public void setEnd(T end) {
        this.end = end;
    }

    public boolean allEmpty() {
        return ((null == begin || "".equals(begin)) && (null == end || "".equals(end)));
    }

    @Override
    public String toString() {
        return String.format("{begin:%s, end:%s}", begin == null ? "null": begin.toString(), end == null ? "null": end.toString());
    }
}
